using System;
using System.Collections.Generic;
using System.Text;

namespace BizTalk.ESB.Extensions.Helpers
{
    public static class StringTools
    {
        public static string[] SplitString(string stringToSplit, string delimiters, int count)
        {
            char[] delimiterArray = delimiters.ToCharArray();
            return stringToSplit.Split(delimiterArray, count);
        }

        public static string[] SplitString(string stringToSplit, string delimiters)
        {
            char[] delimiterArray = delimiters.ToCharArray();
            return stringToSplit.Split(delimiterArray);
        }

        public static String EncodeSpecialXmlCharacters(String input)
        {
            String result = input;
            if (String.IsNullOrEmpty(result) == false)
            {
                result = result.Replace("<", @"&lt;");
                result = result.Replace(">", @"&gt;");
                result = result.Replace("&", @"&amp;");
                result = result.Replace("\"", @"&quot;");
                result = result.Replace("'", @"&apos;");
            }
            return result;
        }
    }
}
